<!-- 年龄比列组件 -->
<template>
  <div class="age">
    <!-- 顶部 -->
    <div class="top">
      <div>年龄比例</div>
      <img src="../images/dataScreen-title.png" alt="" />
    </div>

    <!-- 底部  -->
    <div class="bom">
      <div class="pie_charts" ref="pie_charts"></div>
    </div>
  </div>
</template>

<script setup>
//引入echarts
import * as echarts from "echarts";
//引入echarts的配置项
import { pieOption } from "@/config/echarts/config";
//初始化柱状图
let pie_charts = ref();
onMounted(() => {
  let myCharts = echarts.init(pie_charts.value);
  //配置数据主要是是pieOption.series[0].data
  myCharts.setOption(pieOption);
});
</script>

<style lang="scss" scoped>
.age {
  margin-top: 20px;
  flex: 1;
  background: url(../images/dataScreen-main-lb.png) no-repeat;
  background-size: 100% 100%;
  display: flex;
  flex-direction: column;

  .top {
    margin-left: 14px;
    color: white;
    font-size: 16px;
  }

  .bom {
    flex: 1;

    .pie_charts {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
